<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.10"/>
<title>hwconf/hw_40.h Source File</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="../../vesc.jpg"/></td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.10 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="../../index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="../../pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="../../modules.html"><span>Modules</span></a></li>
      <li><a href="../../annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="../../files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="../../search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="../../files.html"><span>File&#160;List</span></a></li>
      <li><a href="../../globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="../../dir_f2dda9b84c3cbdf4831bd1c6980d572f.html">hwconf</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">hw_40.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="../../d9/da3/hw__40_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">    Copyright 2012-2014 Benjamin Vedder benjamin@vedder.se</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">    This program is free software: you can redistribute it and/or modify</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment">    it under the terms of the GNU General Public License as published by</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment">    the Free Software Foundation, either version 3 of the License, or</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment">    (at your option) any later version.</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment">    This program is distributed in the hope that it will be useful,</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment">    but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment">    GNU General Public License for more details.</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment">    You should have received a copy of the GNU General Public License</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment">    along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment">    */</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> * hw_40.h</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"> *  Created on: 14 apr 2014</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment"> *      Author: benjamin</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor">#ifndef HW_40_H_</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">#define HW_40_H_</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="comment">// Macros</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a8c464f4293f4d6396c8773e0c124aefe">   29</a></span>&#160;<span class="preprocessor">#define ENABLE_GATE()           palSetPad(GPIOC, 10)</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a8436e155c454ff98f4492ed496e285b7">   30</a></span>&#160;<span class="preprocessor">#define DISABLE_GATE()          palClearPad(GPIOC, 10)</span></div>
<div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a293d55ffaebc367416a65d720e0197e2">   31</a></span>&#160;<span class="preprocessor">#define DCCAL_ON()              palSetPad(GPIOB, 12)</span></div>
<div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a4e0946c928e410e4630b2ebe5d71368b">   32</a></span>&#160;<span class="preprocessor">#define DCCAL_OFF()             palClearPad(GPIOB, 12)</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a63f83d086dd65df99727f4c2d2722c0c">   33</a></span>&#160;<span class="preprocessor">#define IS_DRV_FAULT()          (!palReadPad(GPIOC, 12))</span></div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;</div>
<div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a5d5e08cf941c440ad0e802eee233e3ff">   35</a></span>&#160;<span class="preprocessor">#define LED_GREEN_ON()              palSetPad(GPIOC, 4)</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a644339948c77e66e185ba6fc33501f39">   36</a></span>&#160;<span class="preprocessor">#define LED_GREEN_OFF()             palClearPad(GPIOC, 4)</span></div>
<div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a95ee068e1e61fe45d00e66a1bfee85d1">   37</a></span>&#160;<span class="preprocessor">#define LED_RED_ON()                palSetPad(GPIOA, 7)</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a327a94a460a470f29977db858d8074e1">   38</a></span>&#160;<span class="preprocessor">#define LED_RED_OFF()               palClearPad(GPIOA, 7)</span></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="comment"> * ADC Vector</span></div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="comment"> * 0:   IN0     SENS3</span></div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="comment"> * 1:   IN1     SENS2</span></div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="comment"> * 2:   IN2     SENS1</span></div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="comment"> * 3:   IN5     CURR2</span></div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="comment"> * 4:   IN6     CURR1</span></div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="comment"> * 5:   IN3     NC</span></div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;<span class="comment"> * 6:   VREFINT</span></div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<span class="comment"> * 7:   IN11    NC</span></div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="comment"> * 8:   IN12    AN_IN</span></div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="comment"> * 9:   IN13    NC</span></div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="comment"> * 10:  IN15    ADC_EXT</span></div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="comment"> * 11:  IN10    TEMP_MOTOR</span></div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;</div>
<div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a5fa4e3b5a9f68a0d027e8534c24992b5">   57</a></span>&#160;<span class="preprocessor">#define HW_ADC_CHANNELS             12</span></div>
<div class="line"><a name="l00058"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a6a5512f9df920c374bf1fba4ebcb6dd5">   58</a></span>&#160;<span class="preprocessor">#define HW_ADC_NBR_CONV             4</span></div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;<span class="comment">// ADC Indexes</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a193e52ceb49356494bb3a1f79976ac19">   61</a></span>&#160;<span class="preprocessor">#define ADC_IND_SENS1               2</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a30ea22018569d253d38fec402742daf1">   62</a></span>&#160;<span class="preprocessor">#define ADC_IND_SENS2               1</span></div>
<div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#ac8400165c18835d755880827f44099d7">   63</a></span>&#160;<span class="preprocessor">#define ADC_IND_SENS3               0</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a288c607ad4c9daae833f42f05aadf519">   64</a></span>&#160;<span class="preprocessor">#define ADC_IND_CURR1               4</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#ab51eb8bee0733eb32a8c12718de6577b">   65</a></span>&#160;<span class="preprocessor">#define ADC_IND_CURR2               3</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a78de31b7c010917860174990da75b5cb">   66</a></span>&#160;<span class="preprocessor">#define ADC_IND_VIN_SENS            8</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a160e4671222b64530b62e4159fadc9b3">   67</a></span>&#160;<span class="preprocessor">#define ADC_IND_EXT                 10</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a56fb363c89242f6e30e7d8ab62cff70f">   68</a></span>&#160;<span class="preprocessor">#define ADC_IND_VREFINT             6</span></div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="comment">// ADC macros and settings</span></div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;<span class="comment">// Component parameters (can be overridden)</span></div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;<span class="preprocessor">#ifndef V_REG</span></div>
<div class="line"><a name="l00074"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#adc5c29a5cd7ad49dd65b3d5543d81264">   74</a></span>&#160;<span class="preprocessor">#define V_REG               3.3</span></div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;<span class="preprocessor">#ifndef VIN_R1</span></div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a2ca9c5cf55454537eb2276679d87510f">   77</a></span>&#160;<span class="preprocessor">#define VIN_R1              33000.0</span></div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;<span class="preprocessor">#ifndef VIN_R2</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#ac84130dd41edf99a5b09aa8068cb2f74">   80</a></span>&#160;<span class="preprocessor">#define VIN_R2              2200.0</span></div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;<span class="preprocessor">#ifndef CURRENT_AMP_GAIN</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a5d1a774341031145b672f1b915ad46be">   83</a></span>&#160;<span class="preprocessor">#define CURRENT_AMP_GAIN    10.0</span></div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;<span class="preprocessor">#ifndef CURRENT_SHUNT_RES</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a9c79747495715095d39aa29bb3694722">   86</a></span>&#160;<span class="preprocessor">#define CURRENT_SHUNT_RES   0.001</span></div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;<span class="comment">// Input voltage</span></div>
<div class="line"><a name="l00090"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a733c63a91c877981a3226578c49e8826">   90</a></span>&#160;<span class="preprocessor">#define GET_INPUT_VOLTAGE() ((V_REG / 4095.0) * (float)ADC_Value[ADC_IND_VIN_SENS] * ((VIN_R1 + VIN_R2) / VIN_R2))</span></div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;<span class="comment">// Voltage on ADC channel</span></div>
<div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a70d05febee9f9e8d1c841aedf26a4116">   93</a></span>&#160;<span class="preprocessor">#define ADC_VOLTS(ch)       ((float)ADC_Value[ch] / 4095.0 * V_REG)</span></div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;<span class="comment">// NTC Termistors</span></div>
<div class="line"><a name="l00096"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#aef2637635ae9ab37feb3b8c7be5e0e63">   96</a></span>&#160;<span class="preprocessor">#define NTC_RES(adc_val)    (0.0)</span></div>
<div class="line"><a name="l00097"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a0a93ddb6ed829d754ddbe8dc417eeff3">   97</a></span>&#160;<span class="preprocessor">#define NTC_TEMP(adc_ind)   (32.0)</span></div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;<span class="comment">// Double samples in beginning and end for positive current measurement.</span></div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;<span class="comment">// Useful when the shunt sense traces have noise that causes offset.</span></div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;<span class="preprocessor">#ifndef CURR1_DOUBLE_SAMPLE</span></div>
<div class="line"><a name="l00102"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#afb55f34502dfc4fa17794ffbf4046050">  102</a></span>&#160;<span class="preprocessor">#define CURR1_DOUBLE_SAMPLE 1</span></div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;<span class="preprocessor">#ifndef CURR2_DOUBLE_SAMPLE</span></div>
<div class="line"><a name="l00105"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#ad38c1f0879ebed400970c6e314d98cbe">  105</a></span>&#160;<span class="preprocessor">#define CURR2_DOUBLE_SAMPLE 0</span></div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;<span class="comment">// Number of servo outputs</span></div>
<div class="line"><a name="l00109"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a8fbbc12019e6b0ef94174d1d600a8276">  109</a></span>&#160;<span class="preprocessor">#define HW_SERVO_NUM        2</span></div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;<span class="comment">// UART Peripheral</span></div>
<div class="line"><a name="l00112"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#ab38374b5a87c378e7da4ff42ed1a0f86">  112</a></span>&#160;<span class="preprocessor">#define HW_UART_DEV         UARTD6</span></div>
<div class="line"><a name="l00113"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a651c2fdc874409c6e2b9157de58a5007">  113</a></span>&#160;<span class="preprocessor">#define HW_UART_GPIO_AF     GPIO_AF_USART6</span></div>
<div class="line"><a name="l00114"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a9401b883f7b012e954018147d4bbccd5">  114</a></span>&#160;<span class="preprocessor">#define HW_UART_TX_PORT     GPIOC</span></div>
<div class="line"><a name="l00115"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#afa080e653b6501f3c48b210b492de223">  115</a></span>&#160;<span class="preprocessor">#define HW_UART_TX_PIN      6</span></div>
<div class="line"><a name="l00116"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#ac0cdacb6aab832236cafd17b964834a9">  116</a></span>&#160;<span class="preprocessor">#define HW_UART_RX_PORT     GPIOC</span></div>
<div class="line"><a name="l00117"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#aa7c66b47b68c9eb226522df7815dfd70">  117</a></span>&#160;<span class="preprocessor">#define HW_UART_RX_PIN      7</span></div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;<span class="comment">// ICU Peripheral for servo decoding</span></div>
<div class="line"><a name="l00120"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#adf43da1492ccdc2d5de0a6b716bf9595">  120</a></span>&#160;<span class="preprocessor">#define HW_ICU_CHANNEL      ICU_CHANNEL_2</span></div>
<div class="line"><a name="l00121"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a3a9514458c4bf4f963147d72b3e311e4">  121</a></span>&#160;<span class="preprocessor">#define HW_ICU_GPIO_AF      GPIO_AF_TIM3</span></div>
<div class="line"><a name="l00122"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#aa6082a812ace20e791c837b8cf3afbdb">  122</a></span>&#160;<span class="preprocessor">#define HW_ICU_GPIO         GPIOB</span></div>
<div class="line"><a name="l00123"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#af8dfc80b9adb4ecc593548da7d1e8a4e">  123</a></span>&#160;<span class="preprocessor">#define HW_ICU_PIN          5</span></div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;<span class="comment">// I2C Peripheral</span></div>
<div class="line"><a name="l00126"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a46c8828e7c76cb149e871359d8c2c03d">  126</a></span>&#160;<span class="preprocessor">#define HW_I2C_DEV          I2CD2</span></div>
<div class="line"><a name="l00127"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a1e74c823411a37df91b01f35df0fb0e5">  127</a></span>&#160;<span class="preprocessor">#define HW_I2C_GPIO_AF      GPIO_AF_I2C2</span></div>
<div class="line"><a name="l00128"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#af99fe62d994f82b0d006d02bc85dda06">  128</a></span>&#160;<span class="preprocessor">#define HW_I2C_SCL_PORT     GPIOB</span></div>
<div class="line"><a name="l00129"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a9773e7a880df17ad6dd52df43ebf8530">  129</a></span>&#160;<span class="preprocessor">#define HW_I2C_SCL_PIN      10</span></div>
<div class="line"><a name="l00130"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a163f7741af22dcbede7ad28d950b4dee">  130</a></span>&#160;<span class="preprocessor">#define HW_I2C_SDA_PORT     GPIOB</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a2d44a551abc90dbde671399043899c3b">  131</a></span>&#160;<span class="preprocessor">#define HW_I2C_SDA_PIN      11</span></div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;<span class="comment">// Hall/encoder pins</span></div>
<div class="line"><a name="l00134"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a46ae5d5d809f53c7fa0cec031cebe9b6">  134</a></span>&#160;<span class="preprocessor">#define HW_HALL_ENC_GPIO1       GPIOB</span></div>
<div class="line"><a name="l00135"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a8e3efa49f51a67930e4be25fbaf093ad">  135</a></span>&#160;<span class="preprocessor">#define HW_HALL_ENC_PIN1        6</span></div>
<div class="line"><a name="l00136"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a8df05528106a52583bfe95db47d7048f">  136</a></span>&#160;<span class="preprocessor">#define HW_HALL_ENC_GPIO2       GPIOB</span></div>
<div class="line"><a name="l00137"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#abfd378dccb12f069126357bd6a76aaf6">  137</a></span>&#160;<span class="preprocessor">#define HW_HALL_ENC_PIN2        7</span></div>
<div class="line"><a name="l00138"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a6921a466a17c5f43f1acde541c0db6a2">  138</a></span>&#160;<span class="preprocessor">#define HW_HALL_ENC_GPIO3       GPIOB</span></div>
<div class="line"><a name="l00139"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#ab66c95a8c73ebaa313127b184a427bda">  139</a></span>&#160;<span class="preprocessor">#define HW_HALL_ENC_PIN3        8</span></div>
<div class="line"><a name="l00140"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#aaeefdbe7973909c2fd8ae6e89010b15a">  140</a></span>&#160;<span class="preprocessor">#define HW_ENC_TIM              TIM4</span></div>
<div class="line"><a name="l00141"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a0403c44ef6dae5adc0cf246c70689444">  141</a></span>&#160;<span class="preprocessor">#define HW_ENC_TIM_AF           GPIO_AF_TIM4</span></div>
<div class="line"><a name="l00142"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a313a48837cc2d131498804d635e7d3b0">  142</a></span>&#160;<span class="preprocessor">#define HW_ENC_TIM_CLK_EN()     RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE)</span></div>
<div class="line"><a name="l00143"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#af07f66ae02b9a707d42169e5c85f96f8">  143</a></span>&#160;<span class="preprocessor">#define HW_ENC_EXTI_PORTSRC     EXTI_PortSourceGPIOB</span></div>
<div class="line"><a name="l00144"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#aa56a46c608ef84fed0721204b1928e47">  144</a></span>&#160;<span class="preprocessor">#define HW_ENC_EXTI_PINSRC      EXTI_PinSource8</span></div>
<div class="line"><a name="l00145"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a44ede74cb3c7d61f0ce0c1d325982e63">  145</a></span>&#160;<span class="preprocessor">#define HW_ENC_EXTI_CH          EXTI9_5_IRQn</span></div>
<div class="line"><a name="l00146"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a5f35a496780b5be0e3149fdf70658df2">  146</a></span>&#160;<span class="preprocessor">#define HW_ENC_EXTI_LINE        EXTI_Line8</span></div>
<div class="line"><a name="l00147"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#af96c21b36bd98c2f48c26c19a7dc1f3b">  147</a></span>&#160;<span class="preprocessor">#define HW_ENC_EXTI_ISR_VEC     EXTI9_5_IRQHandler</span></div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;<span class="comment">// NRF pins</span></div>
<div class="line"><a name="l00150"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#acd5bc700941a6dedeb98c0a8c52c679a">  150</a></span>&#160;<span class="preprocessor">#define NRF_PORT_CSN    HW_ICU_GPIO</span></div>
<div class="line"><a name="l00151"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#aa20370c3c1ca92913b5d310b2ea9f739">  151</a></span>&#160;<span class="preprocessor">#define NRF_PIN_CSN     HW_ICU_PIN</span></div>
<div class="line"><a name="l00152"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#ae0248102a47a61dd69921748fc4fae4e">  152</a></span>&#160;<span class="preprocessor">#define NRF_PORT_SCK    GPIOC</span></div>
<div class="line"><a name="l00153"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#ad8e80362d2593800f41dad3fb47ceda4">  153</a></span>&#160;<span class="preprocessor">#define NRF_PIN_SCK     5</span></div>
<div class="line"><a name="l00154"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#ae0f289c6b94d4939daf030ee49f8c8d2">  154</a></span>&#160;<span class="preprocessor">#define NRF_PORT_MOSI   HW_I2C_SDA_PORT</span></div>
<div class="line"><a name="l00155"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#aff1413c56be398e5001f0bd299a7b524">  155</a></span>&#160;<span class="preprocessor">#define NRF_PIN_MOSI    HW_I2C_SDA_PIN</span></div>
<div class="line"><a name="l00156"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a0adc95dc9b7cc1dacb8f65e0acdd5263">  156</a></span>&#160;<span class="preprocessor">#define NRF_PORT_MISO   HW_I2C_SCL_PORT</span></div>
<div class="line"><a name="l00157"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a571a60bfc9ba3e29e458ffed0606e93e">  157</a></span>&#160;<span class="preprocessor">#define NRF_PIN_MISO    HW_I2C_SCL_PIN</span></div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;<span class="comment">// Measurement macros</span></div>
<div class="line"><a name="l00160"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a7a812098eed1e9eb23927b8dbeb1abe9">  160</a></span>&#160;<span class="preprocessor">#define ADC_V_L1                    ADC_Value[ADC_IND_SENS1]</span></div>
<div class="line"><a name="l00161"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a4610571006cbae7f653c5d82ccf6c52d">  161</a></span>&#160;<span class="preprocessor">#define ADC_V_L2                    ADC_Value[ADC_IND_SENS2]</span></div>
<div class="line"><a name="l00162"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#ace2b8dbe631607ed55c3f001b656ce9c">  162</a></span>&#160;<span class="preprocessor">#define ADC_V_L3                    ADC_Value[ADC_IND_SENS3]</span></div>
<div class="line"><a name="l00163"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#af3a0d999a73c888db2dccb37b44aca4f">  163</a></span>&#160;<span class="preprocessor">#define ADC_V_ZERO                  (ADC_Value[ADC_IND_VIN_SENS] / 2)</span></div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;<span class="comment">// Macros</span></div>
<div class="line"><a name="l00166"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a401456d3a2f40dd2ee35a460f19848a2">  166</a></span>&#160;<span class="preprocessor">#define READ_HALL1()                palReadPad(HW_HALL_ENC_GPIO1, HW_HALL_ENC_PIN1)</span></div>
<div class="line"><a name="l00167"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a585142b82c099ce7c1887d5ce495fba9">  167</a></span>&#160;<span class="preprocessor">#define READ_HALL2()                palReadPad(HW_HALL_ENC_GPIO2, HW_HALL_ENC_PIN2)</span></div>
<div class="line"><a name="l00168"></a><span class="lineno"><a class="line" href="../../d9/da3/hw__40_8h.html#a029f35e27b540da9db6a98a43e8bf33c">  168</a></span>&#160;<span class="preprocessor">#define READ_HALL3()                palReadPad(HW_HALL_ENC_GPIO3, HW_HALL_ENC_PIN3)</span></div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* HW_40_H_ */</span><span class="preprocessor"></span></div>
</div><!-- fragment --></div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="https://github.com/joshdellay" target="_new">Josh Dellay</a>